home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SPACE 2
/
SPACE - Library 2 - Volume 1.iso
/
apps
/
255
/
applic
/
dayoweek.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1988-06-14
|
568b
|
22 lines
FUNCTION DayOfWeek(m,d,y : integer) : integer;
{Passed on with many thanks to the anonymous person who placed
this function in public domain!
This function will return a number 0 thru 6
0 is Sunday, 1 is Monday, 2 is Tuesday, etc.
m is month, d is day, y is year
}
VAR
c : integer;
BEGIN
m := m - 2;
IF m <= 0 THEN
BEGIN
m := m + 12;
y := y - 1;
END;
c := y DIV 100;
y := y - (c * 100);
DayOfWeek := (((26 * m - 2) DIV 10) + d + y + (y DIV 4) +
(c DIV 4) - 2 * c) MOD 7;
END {dayofweek};